<?php
session_start();
$sql_show="SELECT * FROM tbl_admin where admin_id='$admin_id_sess'";
$rst_show=mysql_query($sql_show);
$row_show=mysql_fetch_array($rst_show);
$password=$row_show['password'];

if(isset($_REQUEST['chgPwdKey']))
{
  $old_pwd=$_REQUEST['oldPassword'];
  $new_pwd=$_REQUEST['newPassword'];
    if($old_pwd==$password)
	{
	$password=$new_pwd;
    $sql_addusr="update tbl_admin set
			 password='$password'
			 where admin_id='$admin_id_sess'";
			 $rst_addusr=mysql_query($sql_addusr);
			 $smsg="You Password changed Successfully";
     }
	else
	{
	 $emsg="Invalid password. Enter valid One"; 
	}
}
 ?>
<form name="form1"  id="form1" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="chgPwdKey" id="chgPwdKey">
<table width="100%"  border="1" cellspacing="0" class="container" >
  <tr>
    <td width="718" height="27" class="tdHeader">Change Password</td>
  </tr>
  <tr>
    <td height="577"><table width="553" border="0">
      <tr>
        <td height="30">&nbsp;</td>
        <td colspan="2" align="center"><?php
                          if(!empty($smsg))
						    echo $smsg;
						  else if(!empty($emsg))
						  	echo  $emsg; ?>						     </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="78" height="32">&nbsp;</td>
        <td>Old Password</td>
        <td><input type="password" name="oldPassword" id="oldPassword"  class="text" /></td>
        <td width="84">&nbsp;</td>
      </tr>
      <tr>
        <td height="32">&nbsp;</td>
        <td>New Password</td>
        <td><input type="password" name="newPassword" id="newPassword"  class="text" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="32">&nbsp;</td>
        <td>Confirm New Password</td>
        <td><input type="password" name="cfrmNewPassword" id="cfrmNewPassword"  class="text" /></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="29">&nbsp;</td>
        <td colspan="2"><div align="center">
          <input type="button" name="button" value="Change Password" class="button" onclick="changePassword();" />
        </div></td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</form>